<?php $this->load->view('layout/header'); ?>
<script type="text/javascript" charset="utf-8" src="/static/bk/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/bk/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/bk/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" charset="utf-8" src="/static/bk/ueditor/lang/zh-cn/zh-cn.js"></script>
<form runat="server" action="<?php echo $post_url; ?>" id="form1" method="post">
    <div id="container">
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table_form">
            <tr class="table_form_title">
                <td colspan="4">
                    <span id="lblTitle"><?php echo isset($block['blockid'])?'修改':'添加';?></span>片段内容 
                </td>
            </tr>
              
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>标题：
                </td>
                <td>
                    <input name="blockname" type="text" id="blockname" value="<?php echo $block['blockname']; ?>" />
                    <span id="blockname_tips" style="color:Red;display:none;">不能为空</span>
                </td>
            </tr>
            
            
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    内容：
                </td>
                <td>
                    <script id="blockcontent" type="text/plain" style="width: 100%; height: 350px;"><?php echo $block['blockcontent']; ?></script>
                    <script type="text/javascript">
                        var ue = UE.getEditor('blockcontent', {
                            textarea: 'blockcontent'
                        });</script>

                </td>
            </tr>
           
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>访问次数：
                </td>
                <td>
                    <input name="clicknum" num="true" type="text" value="<?php echo $block['clicknum']; ?>" id="clicknum" class="input_shadow" />
                    <span id="clicknum_tips" style="color:Red;display:none;">不能为空</span>
                    <span id="clicknum_num_tips" style="color:Red;display:none;">只能为数字</span>
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    <span class="star">*</span>排序号：
                </td>
                <td>
                    <input name="listid"  num="true" type="text" value="<?php echo $block['listid']; ?>" id="listid" />
                    <span id="listid_tips" style="color:Red;display:none;">不能为空</span>
                    <span id="listid_num_tips" style="color:Red;display:none;">只能为数字</span>
                    <input type="hidden" name="hidlistID" id="hidlistID" value="2" />
                </td>
            </tr>
            <tr class="table_form_row">
                <td style="width: 15%" align="right">
                    是否关闭：
                </td>
                <td>
                    <span id="radIsClose">
                        <input id="isclose" type="radio" name="isclose" value="1" <?php echo $block['isclose'] == 1 ? 'checked="checked" ' : ''; ?>/>
                        <label for="radIsClose_0">是</label>
                        <input id="radIsClose_1" type="radio" name="isclose" value="0" <?php echo $block['isclose'] == 0 ? 'checked="checked" ' : ''; ?>/>
                        <label for="radIsClose_1">否</label>
                    </span>
                </td>
            </tr>
            
            <tr class="table_form_btn">
                <td align="right">
                    <div id="hiddendiv" style="display: none;"></div>
                </td>
                <td colspan="3">
                    <input type="submit" name="btnSave" value="保存" id="btnSave" />
                    <input type="button" name="Submit" value="返回" onclick="javascript:history.go(-1);" />
                    <span id="errMsg" style="color:Red;"></span>
                </td>
            </tr>
        </table>
    </div>

</form>


<script>
    var is = true; 
    $('#blockname,#listid,#clicknum').change(function() {
        input_tips($(this));
    });

    $('#form1').submit(function() {
        var is = true;       
        if (!input_tips($('#blockname'))) {
            is = false;
        }
        if (!input_tips($('#clicknum'))) {
            is = false;
        }
        if (!input_tips($('#listid'))) {
            is = false;
        }
        if (!input_tips($('#clicknum'))) {
            is = false;
        }
        return is;
    });
</script>
<?php $this->load->view('layout/footer'); ?>
